package com.otp.customUI;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Size;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.otp.Activity.R;

/**
 * Created by Administrator on 2016/1/3.
 */
public class TabMenu extends LinearLayout{

    private TextView topText = null;
    private TextView belowText = null;

    public TabMenu(Context context){
        this(context, null);
    }

    public TabMenu(Context context, AttributeSet attrs) {
        super(context,attrs);
        View view = LayoutInflater.from(context).inflate(R.layout.menu_tab, this, true);
        topText = (TextView) view.findViewById(R.id.TopText);
        belowText = (TextView) view.findViewById(R.id.BelowText);
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RadioButton);
        String topTextContent = typedArray.getString(R.styleable.RadioButton_TopText);
        String belowTextContent = typedArray.getString(R.styleable.RadioButton_BelowText);
        Typeface iconfont = Typeface.createFromAsset(getResources().getAssets(), "iconfont.ttf");
        topText.setTypeface(iconfont);
        belowText.setTypeface(iconfont);
        topText.setText(topTextContent);
        topText.setTextColor(Color.rgb(0, 0, 0));
        topText.setTextSize(35);
        belowText.setText(belowTextContent);
        belowText.setTextColor(Color.rgb(0, 0, 0));
        belowText.setTextSize(10);
    }

    public void setTopTextColor(int color){
       topText.setTextColor(color);
    }

    public TextView getTopText() {
        return topText;
    }

    public void setTopText(TextView topText) {
        this.topText = topText;
    }
}
